// 封装对本队存储的操作


// 从本地取值
export const getItem = (key) => {
  let data
  try {
    data = JSON.parse(localStorage.getItem(key))
  } catch (error) {
    data = localStorage.getItem(key)
  }
  return data
}

// 存值的方法
export const setItem = (key,value) => {
  if(typeof value === 'object'){
    localStorage.setItem(key,JSON.stringify(value))
  }else{
    localStorage.setItem(key,value)
  }
}


// 删除的方法
export const removeItem = key => {
  localStorage.removeItem(key)
}

